package com.web.service.impl;

import com.web.dao.UserDAO;
import com.web.dao.impl.UserDAOimpl;

import com.web.entity.User;
import com.web.service.UserService;

/*
 * 用户逻辑实现类
 * */
    public class UserServiceimpl implements UserService {

    // 创建dao对象
    private UserDAO userDAO = new UserDAOimpl();

    @Override
    public User login(String username,String password) {
        // 通过用户名查询用户
        User user = userDAO.selectUserByUsername(username);
        // 验证用户是否存在，密码是否正确
        if (user != null) {
            if (password.equals(user.getPassword())){
                return user;
            }
        }
        return null;
    }
}
